/*
struct ListNode {
    int val;
    struct ListNode *next;
    ListNode(int x) : val(x), next(NULL) {}
};*/
class PalindromeList
{
public:
    bool chkPalindrome(ListNode* A)
    {
        // write code here
        int arr[1000] = { 0 };
        ListNode* pcur = A;
        int count = 0;
        while (pcur)
        {
            arr[count] = pcur->val;
            count++;
            pcur = pcur->next;
        }
        int left = 0, right = count - 1;
        while (left < right)
        {
            if (arr[left] != arr[right])
                return false;
            left++, right--;
        }
        return true;
    }
};